﻿Ext.define('app.prm.product.Index',
{
    extend: 'Ext.grid.Panel',
    border: true,
    title: localize('ProductList'),
    viewConfig: {
        enableTextSelection: true //可以复制单元格文字
    },
    //multiColumnSort: true,
    forceFit: false,
    controller: 'product',
    requires: ['app.prm.product.ProductController'],
    initComponent: function () {
        var me = this;
        me.tbar = [
              { text: '增加', handler: 'onAdd' },
              { text: '编辑', handler: 'onEdit' },
              { text: '删除', handler: 'onDel' },
              '->',
              {
                  text: '刷新', glyph: 0xf021, handler: 'onRefresh'
              }
        ];
        me.store = Ext.create("app.ux.PageInquiryStore", { url: '/api/services/app/product/GetAll', remoteSort: false });
        me.pagingBar = Ext.create({
            xtype: 'pagingtoolbar',
            store: me.store,   // same store GridPanel is using
            dock: 'bottom',
            displayInfo: true
        });
        me.dockedItems = [me.pagingBar]




        me.callParent(arguments);
    },
    columns: [
        {
            xtype: 'actioncolumn',
            width: 70,
            header: localize('Operating'),
            items: [
            {
                icon: '/Content/images/page_white_picture.png',
                tooltip: '项目详细',
                handler: 'onOpenDetail'
            }]
        },
        {
            text: "#", xtype: 'rownumberer', width: 50
        },
        { header: '产品号', dataIndex: 'code' },
        { header: localize('ChineseName'), dataIndex: 'substanceCnName' },
        { header: localize('EnglishName'), dataIndex: 'substanceEnName' },
        { header: 'CAS', dataIndex: 'substanceCAS' },
        { header: localize('Formula'), dataIndex: 'substanceFormula',hidden:true },
        { header: localize('MolecularWeight'), dataIndex: 'substanceMolecularWeight', hidden: true }
    ],
    listeners: {
        rowdblclick: 'onProductRowDbClick'
    }
});
